import CustomVanInput from '@/components/Form/CustomVanInput'
import collapse from '@/components/TransitionCollapse'
import { inputType } from '@/components/Form/fieldType'

export default {
  components: {
    CustomVanInput,
    collapse,
  },

  methods: {
    createInput ({ fields }) {
      const { setting = {} } = fields
      const { has_fill = false } = setting
      if (!has_fill) return {}

      const { input } = inputType
      const { getProp: inputProp } = input
      const { tips } = fields.setting
      const prop = inputProp({
        fields: {
          ...fields, title: '', field_type: '', setting: { ...fields.setting, tips: (tips || '\n') },
        },
      })
      return prop
    },
  },
}
